package iqq.client;

import iqq.im.QQActionListener;
import iqq.im.QQException;
import iqq.im.QQException.QQErrorCode;
import iqq.im.event.QQActionEvent;
import iqq.im.event.QQActionEvent.Type;

public class QQActionManager implements QQActionListener {

	private static QQActionManager qqActionManager;

	public static QQActionManager getInstance() {
		if (qqActionManager == null) {
			qqActionManager = new QQActionManager();
		}
		return qqActionManager;
	}

	@Override
	public void onActionEvent(QQActionEvent event) {
		if (event.getType() == Type.EVT_OK) {
			// 到这里就算是登录成功了
			
			
			
		} else if (event.getType() == Type.EVT_ERROR) {
			QQException e = (QQException) event.getTarget();
			
			if (e.getError() == QQErrorCode.NEED_CAPTCHA) {
				// 需要验证码
				ClientService.doVerify(ClientService.geInstance());
			}
		}
	}

}
